summaryrefslogtreecommitdiffstats
path: root/src/Blocks/BlockNoteBlock.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Blocks/BlockNoteBlock.h')
-rw-r--r--src/Blocks/BlockNoteBlock.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/Blocks/BlockNoteBlock.h b/src/Blocks/BlockNoteBlock.h
new file mode 100644
index 000000000..ac1ab7238
--- /dev/null
+++ b/src/Blocks/BlockNoteBlock.h
@@ -0,0 +1,43 @@
+
+#pragma once
+
+#include "BlockEntity.h"
+#include "../BlockEntities/NoteEntity.h"
+
+
+
+
+
+class cBlockNoteBlockHandler final :
+ public cBlockEntityHandler
+{
+ using Super = cBlockEntityHandler;
+
+public:
+
+ using Super::Super;
+
+private:
+
+ virtual void OnDigging(
+ cChunkInterface & a_ChunkInterface,
+ cWorldInterface & a_WorldInterface,
+ cPlayer & a_Player,
+ const Vector3i a_BlockPos
+ ) const override
+ {
+ a_WorldInterface.DoWithBlockEntityAt(a_BlockPos.x, a_BlockPos.y, a_BlockPos.z, [](cBlockEntity & a_BlockEntity)
+ {
+ if (a_BlockEntity.GetBlockType() != E_BLOCK_NOTE_BLOCK)
+ {
+ return false;
+ }
+
+ auto & NoteEntity = static_cast<cNoteEntity &>(a_BlockEntity);
+
+ NoteEntity.MakeSound();
+
+ return true;
+ });
+ }
+};